package com.wind.cqboot.plugin;

import org.jetbrains.annotations.NotNull;
import org.springframework.stereotype.Component;

import lombok.extern.slf4j.Slf4j;
import net.lz1998.pbbot.bot.Bot;
import net.lz1998.pbbot.bot.BotPlugin;
import net.lz1998.pbbot.utils.Msg;
import onebot.OnebotEvent;

@Slf4j
@Component
public class WelcomePlugin extends BotPlugin
{
    @Override
    public int onGroupIncreaseNotice(@NotNull Bot bot,
            @NotNull OnebotEvent.GroupIncreaseNoticeEvent event)
    {
        log.info("用户{}加入群", event.getUserId());
        Long groupId = event.getGroupId();
        Long userId = event.getUserId();
        String content = " 欢迎新人，别太客气，把这里当家一样。你最好把钱放在家里。"
                + "请先阅读群公告，文档地址 http://doc.rycloud.zmrit.com/ http://doc.ruoyi.vip/ruoyi-cloud/"
                + "演示环境地址 http://ruoyi.ant.zmrit.com "
                + "启动演示视频 https://www.bilibili.com/video/av95044508/ "
                + "如有疑问，请到issue提问。本群不提供基础教学,文档有提升教程地址,"
                + "提问请整理好操作步骤、期望结果、实际结果。" + "最后，以任何名义收费的开源都是耍流氓！！！";
        Msg.builder().at(userId).text(content).sendToGroup(bot, groupId);
        return MESSAGE_IGNORE;
    }
}
